package com.poem.mapper;

import com.github.pagehelper.Page;
import com.poem.annotation.AutoFill;
import com.poem.dto.TypesQueryDTO;
import com.poem.entity.Types;
import com.poem.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: TypesMapper
 * @Author: YLY
 * @Description:
 * @Date: 2025/10/19
 * @Version: 1.0
 */

@Mapper
public interface TypesMapper {

    @Select("select * from type order by update_time desc")
    List<Types> queryAllTypes();

    @AutoFill(value = OperationType.INSERT)
    void addType(Types type);

    @AutoFill(value = OperationType.UPDATE)
    void updateType(Types type);

    Page<Types> pageQuery(TypesQueryDTO typesQueryDTO);

    void deleteBatch(List<Long> ids);

    @Select("select * from type where id = #{id}")
    Types getById(Long id);
}
